
import 'package:flutter/cupertino.dart';
import 'package:vega/repo/api/Api.dart';
import 'package:vega/repo/model/search_list_model.dart';

class SearchViewModel with ChangeNotifier {
  final List<SearchListItem> searchResList = [];

  String _keyword = '';

  Future search(String kw, [int p = 1]) async {
    _keyword = kw;
    Api.instance().searchList(kw, p).then((value) {
      searchResList.clear();
      searchResList.addAll(value?? []);
      notifyListeners();
    });
  }
}